from django.template import Library

register = Library()

def item(sequence, key):
    return sequence[key]
item.is_safe = False

register.filter(item)